package net.zbus.rpc;

import java.util.HashMap;
import java.util.Map;

import net.zbus.ClientPool;
import net.zbus.ClientPoolConfig;

public class RpcClient {

	public static void main(String[] args) throws Exception {
		ClientPoolConfig config = new ClientPoolConfig();
		config.setHost("127.0.0.1");
		config.setPort(15555);

		ClientPool pool = new ClientPool(config);

		Rpc rpc = new Rpc(pool, "MyRpc");
		
		User user = new User();
		user.setName("hong");
		user.setAddr("test");
		byte[] image = new byte[10];
		for(int i=0;i<image.length;i++)
			image[i] = (byte)i;
		user.setImage(image);
		
		Map<String,Object> map = new HashMap<String, Object>();
		map.put("name", "hong");
		map.put("addr", "sz");
		map.put("image", image);
		
		Object res = rpc.module("test").invoke("user", "hong");
		System.out.println(res);
		
		//res = rpc.invoke("user", "hong"); 
		//System.out.println(res);  
		 
		
		pool.destroy();
	}
}
